# Contributor: Magnus Sandin <magnus.sandin@gmail.com>
# Maintainer: Magnus Sandin <magnus.sandin@gmail.com>
pkgname=go2rtc
pkgver=1.9.6
pkgrel=0
pkgdesc="Ultimate camera streaming application"
url="https://github.com/AlexxIT/go2rtc"
arch="all"
license="MIT"
depends="ffmpeg"
makedepends="go"
subpackages="$pkgname-openrc"
source="
	$pkgname-$pkgver.tar.gz::https://github.com/AlexxIT/go2rtc/archive/refs/tags/v$pkgver.tar.gz
	$pkgname.confd
	$pkgname.initd
	$pkgname.logrotate
	$pkgname.yaml
	"
options="!check" # No tests available

export GOCACHE="${GOCACHE:-"$srcdir/go-cache"}"
export GOTMPDIR="${GOTMPDIR:-"$srcdir"}"
export GOMODCACHE="${GOMODCACHE:-"$srcdir/go"}"

build() {
	go build -v
}

package() {
	install -Dm644 "$srcdir"/$pkgname.yaml -t "$pkgdir"/etc/go2rtc/
	install -Dm644 "$srcdir"/$pkgname.logrotate "$pkgdir"/etc/logrotate.d/$pkgname.conf
	install -Dm755 "$srcdir"/$pkgname.initd "$pkgdir"/etc/init.d/$pkgname
	install -Dm755 "$srcdir"/$pkgname.confd "$pkgdir"/etc/conf.d/$pkgname
	install -Dm755 go2rtc -t "$pkgdir"/usr/bin/
}

sha512sums="
c907c80aedb0eb0ef6b0e24bb0e30e158cdd27340e2cc55783593ef325ae131f5ff7d3314d209c799527656f78b6ea914638e734707271d75c88652156974fdf  go2rtc-1.9.6.tar.gz
b841282b96110ec59a7aa539db0737327b09549d55c78dc4b2c3b28b4a6ad1facf015b3175cb6d3a38f13e47aa6314ef3dc1514a4e60dd653a97409ec54ba706  go2rtc.confd
bdbc15a16426455ff3bec1e9dbdbcb63f932bd85d634be96e7d46bddd55c63e8636303f39d5a069c62305d76b58d496cca7404f58913a1053553e1a675459733  go2rtc.initd
9fac59cdeb6f48c07fe6169e68e208c648b56cbe9841f0e6896908c55d494a2313f34f2f6902f1f21d33ebb030295d01098601245b5b7f61a4429c1d72678483  go2rtc.logrotate
efd034b8a0d1967ff42501118625dcb4cd79893293354019872ba1100f7bb43e7365a558b3fab50aa0d9207dfdd6a72f35e012e5dadca0aee5020e1357d1f173  go2rtc.yaml
"
